import request from '@/config/axios'

// 学院 VO
export interface DepartmentVO {
  id: number // 学院ID
  name: string // 学院名称
  code: string // 学院代码
  sort: number // 排序
}

// 学院 API
export const DepartmentApi = {
  // 查询学院分页
  getDepartmentPage: async (params: any) => {
    return await request.get({ url: `/run/department/page`, params })
  },

  // 查询学院详情
  getDepartment: async (id: number) => {
    return await request.get({ url: `/run/department/get?id=` + id })
  },

  // 新增学院
  createDepartment: async (data: DepartmentVO) => {
    return await request.post({ url: `/run/department/create`, data })
  },

  // 修改学院
  updateDepartment: async (data: DepartmentVO) => {
    return await request.put({ url: `/run/department/update`, data })
  },

  // 删除学院
  deleteDepartment: async (id: number) => {
    return await request.delete({ url: `/run/department/delete?id=` + id })
  },

  // 导出学院 Excel
  exportDepartment: async (params) => {
    return await request.download({ url: `/run/department/export-excel`, params })
  },
}